<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link th:href="@{/common/layui/css/layui.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/common/layui/admin.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/common/layui/layui.js}"></script>
    <script th:src="@{/common/jquery/jquery.js}"></script>
</head>
<body>
    <form class="layui-form" action="" lay-filter="component-form-element">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">选择feature</label>
                <div class="layui-input-inline">
                    <select name="featureid" lay-filter="feature" lay-verify="" lay-search="">
                        <option value="">请选择feature</option>
                        <option value="1">unicode</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">文件名</label>
                <div class="layui-input-block">
                    <input type="text" name="filename" lay-verify="title" autocomplete="off" placeholder="请输入文件名" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">行号</label>
                <div class="layui-input-block">
                    <input type="text" name="noteline" lay-verify="title" autocomplete="off" placeholder="请输入文件名" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">Code</label>
            <div class="layui-input-block">
                <textarea name="notecode" placeholder="请输入相关代码" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">Content</label>
            <div class="layui-input-block">
                <textarea name="notecontent" placeholder="请输入备注" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">相关release</label>
            <div class="layui-input-block">
                <textarea name="noterelease" placeholder="请输入相关release" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="component-form-element">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</body>
<script type="text/javascript">
    function setName(filename){
        $("#filename").val(filename);
    }
    layui.use('form',function () {
        var form = layui.form;
        form.on('submit(component-form-element)', function(data){
            var field=data.field;
            var featureid=field.featureid;
            var filename=field.filename;
            var noteline=field.noteline;
            var notecode=field.notecode;
            var notecontent=field.notecontent;
            var noterelease=field.noterelease;
            $.ajax({
                url:"http://192.168.56.1:8888/ws/addNote",
                type:"post",
                data: {featureid:featureid,filename:filename,noteline:noteline,notecode:notecode,notecontent:notecontent
                        ,noterelease:noterelease},
                success:function (data) {
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index);
                }
            })
        });
    })
</script>

</html>